/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CSA2;

/**
 *
 * @author lubinchen
 */


import java.net.*;
import java.io.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;


public class callthis {

   int port=4111;
   InetAddress tempIpAdd= null;
   InetAddress ownIP=null;


   public void setServer(){

       ChatServer server=new ChatServer(port);
   }



   public callthis(){
  
   }


   public void findOwnIP(){
       try{
	      ownIP=InetAddress.getLocalHost();
	      System.out.println("IP of my own system is := "+ownIP.getHostAddress());

            }catch (Exception e){
	      System.out.println("Exception caught "+e.getMessage());
	  }
   }


   public void connectMyself(){

    	    ChatClient client= new ChatClient(ownIP,port);
    }


    public void newClient(){

    	    ChatClient client= new ChatClient(tempIpAdd,port);
    }



    public InetAddress getInet(String DestinationIP)
    {

    try{
        tempIpAdd= InetAddress.getByName(DestinationIP);

        }catch (Exception e){}

    return tempIpAdd;
    }

public static  void main(String args[]){



    callthis call=new callthis();
    call.setServer();
    call.findOwnIP();
    call.connectMyself();


    //add new clients other than yourself
    
    //call.getInet("");
    //call.newClient();

}

}

